#pragma once

class master_service : public acl::master_fiber
{
public:
	master_service(void);
	~master_service(void);

protected:
	// @override
	void on_accept(acl::socket_stream &conn);

	// @override
	void proc_pre_jail(void);

	// @override
	void proc_on_listen(acl::server_socket &ss);

	// @override
	void proc_on_init(void);

	// @override
	void proc_on_exit(void);

	// @override
	bool proc_on_sighup(acl::string &);

private:
	acl::sslbase_conf *conf_;
	FUNASR_HANDLE asr_handle_;
	std::unordered_map<std::string, int> hws_map;
	acl::sslbase_io *setup_ssl(acl::socket_stream &conn,
							   acl::sslbase_conf &conf);
	int connect_num = 0;
};
